package com.example.yichuangyun.ui.activity;

import android.os.CountDownTimer;

import com.example.yichuangyun.application.MyApplication;
import com.example.yichuangyun.databinding.ActivitySplashBinding;
import com.example.yichuangyun.mvvm.base.BaseActivity;
import com.example.yichuangyun.mvvm.base.BaseViewModel;
import com.example.yichuangyun.utils.JumpIntent;

/**
 * 启动页
 */
public class SplashActivity extends BaseActivity<ActivitySplashBinding, BaseViewModel> {


    @Override
    protected BaseViewModel bindModel() {
        return getViewModel(this, BaseViewModel.class);
    }

    @Override
    protected void initInject() {
        getActivityComponent().inject(this);
    }

    @Override
    public void initData() {
        new CountDownTimer(2000, 1000) {
            @Override
            public void onTick(long millisUntilFinished) {
            }

            @Override
            public void onFinish() {
                JumpIntent.jump(SplashActivity.this, MyApplication.manager.isLogin()
                        ? MainActivity.class : LoginActivity.class, true);
            }
        }.start();
    }
}